define(["jquery"], function () {
    'use strict'
    class magnifier {
        constructor(headSelector, contentSelector, event = "click", cb = null) {
            this.headList = $(headSelector);
            this.contentList = $(contentSelector);
            this.index = 0;
            this.eve = event;
            this.cb=cb;
        }
        bindEvent() {
            $.each(this.headList, $.proxy(this.addEvent, this))
        }
        addEvent(i, item) {
            $(item).on(this.eve, $.proxy(this.onNavItemClick, { _: this, index: i, currentItem: item }))
        }
        onNavItemClick() {
            $.each(this._.contentList, (i, item) => {
                $(item).css({
                    display: `${this.index === i ? "block" : "none"}`
                })
            });
            console.log(this._.cb);
            this._.cb ? this._.cb(this.currentItem) : "";
        }
        init() {
            this.bindEvent();
        }
    }
    return magnifier;
})